package com.person.modules.person.controller;

import com.person.common.utils.DateUtils;
import com.person.common.utils.R;
import com.person.modules.person.entity.UserDocEvaluateEntity;
import com.person.modules.person.service.UserDocEvaluateService;
import com.person.modules.sys.controller.AbstractController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Date;

@Controller
@RequestMapping("/person")
public class UserDocEvaluateController extends AbstractController{
    @Autowired
    UserDocEvaluateService userDocEvaluateService;

    /**
     * 评价员工
     */
    @PostMapping("/evaluate")
    @CrossOrigin
    @ResponseBody
    @Transactional
    public R evaluate(UserDocEvaluateEntity userDocEvaluateEntity) {
        userDocEvaluateEntity.setCompanyId(getUser().getCompanyId());
        userDocEvaluateEntity.setCreateTime(DateUtils.currentTimeFormat());
        userDocEvaluateService.save(userDocEvaluateEntity);
        return R.ok();
    }
}
